home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / include / netiso / eonvar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  5.7 KB  |  171 lines  |  [TEXT/R*ch]

  1. /*-
  2.  * Copyright (c) 1991, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)eonvar.h    8.1 (Berkeley) 6/10/93
  34.  */
  35.  
  36. /***********************************************************
  37.         Copyright IBM Corporation 1987
  38.  
  39.                       All Rights Reserved
  40.  
  41. Permission to use, copy, modify, and distribute this software and its 
  42. documentation for any purpose and without fee is hereby granted, 
  43. provided that the above copyright notice appear in all copies and that
  44. both that copyright notice and this permission notice appear in 
  45. supporting documentation, and that the name of IBM not be
  46. used in advertising or publicity pertaining to distribution of the
  47. software without specific, written prior permission.  
  48.  
  49. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  50. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  51. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  52. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  53. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  54. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  55. SOFTWARE.
  56.  
  57. ******************************************************************/
  58.  
  59. /*
  60.  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  61.  */
  62.  
  63. #define EON_986_VERSION 0x3
  64. #define EON_VERSION 0x1
  65.  
  66. #define EON_CACHESIZE 30
  67.  
  68. #define E_FREE     1
  69. #define E_LINK    2
  70. #define E_ES     3
  71. #define E_IS     4
  72.  
  73.  
  74. /* 
  75.  * this overlays a sockaddr_iso
  76.  */
  77.  
  78. struct sockaddr_eon {
  79.     u_char             seon_len;    /* Length */
  80.     u_char             seon_family;    /* AF_ISO */
  81.     u_char            seon_status;    /* overlays session suffixlen */
  82. #define EON_ESLINK_UP        0x1
  83. #define EON_ESLINK_DOWN        0x2
  84. #define EON_ISLINK_UP        0x10
  85. #define EON_ISLINK_DOWN        0x20
  86. /* no change is neither up or down */
  87.     u_char            seon_pad1;    /* 0, overlays tsfxlen */
  88.     u_char            seon_adrlen;
  89.     u_char            seon_afi;        /* 47 */
  90.     u_char            seon_idi[2];    /* 0006 */
  91.     u_char            seon_vers;        /* 03 */
  92.     u_char            seon_glbnum[2];    /* see RFC 1069 */
  93.     u_char            seon_RDN[2];    /* see RFC 1070 */
  94.     u_char            seon_pad2[3];    /* see RFC 1070 */
  95.     u_char            seon_LAREA[2];    /* see RFC 1070 */
  96.     u_char            seon_pad3[2];    /* see RFC 1070 */
  97.         /* right now ip addr is  aligned  -- be careful --
  98.          * future revisions may have it u_char[4]
  99.          */
  100.     u_int            seon_ipaddr;    /* a.b.c.d */
  101.     u_char            seon_protoid;    /* NSEL */
  102. };
  103.  
  104. #ifdef EON_TEMPLATE
  105. struct sockaddr_eon eon_template = {
  106.     sizeof (eon_template), AF_ISO, 0, 0, 0x14,
  107.     0x47, 0x0, 0x6, 0x3, 0
  108. };
  109. #endif
  110.  
  111. #define DOWNBITS ( EON_ESLINK_DOWN | EON_ISLINK_DOWN )
  112. #define UPBITS ( EON_ESLINK_UP | EON_ISLINK_UP )
  113.  
  114. #define    SIOCSEONCORE _IOWR('i',10, struct iso_ifreq) /* EON core member */
  115. #define    SIOCGEONCORE _IOWR('i',11, struct iso_ifreq) /* EON core member */
  116.  
  117. struct eon_hdr {
  118.     u_char     eonh_vers; /* value 1 */
  119.     u_char     eonh_class;  /* address multicast class, below */
  120. #define        EON_NORMAL_ADDR        0x0
  121. #define        EON_MULTICAST_ES    0x1
  122. #define        EON_MULTICAST_IS    0x2
  123. #define        EON_BROADCAST        0x3
  124.     u_short eonh_csum;  /* osi checksum (choke)*/
  125. };
  126. struct eon_iphdr {
  127.     struct    ip    ei_ip;
  128.     struct    eon_hdr    ei_eh;
  129. };
  130. #define EONIPLEN (sizeof(struct eon_hdr) + sizeof(struct ip))
  131.  
  132. /* stole these 2 fields of the flags for I-am-ES and I-am-IS */
  133. #define    IFF_ES    0x400
  134. #define    IFF_IS    0x800
  135.  
  136. struct eon_stat {
  137.     int    es_in_multi_es;
  138.     int    es_in_multi_is;
  139.     int    es_in_broad;
  140.     int    es_in_normal;
  141.     int    es_out_multi_es;
  142.     int    es_out_multi_is;
  143.     int    es_out_broad;
  144.     int    es_out_normal;
  145.     int    es_ipout;
  146.  
  147.     int    es_icmp[PRC_NCMDS];
  148.     /* errors */
  149.     int    es_badcsum;
  150.     int    es_badhdr;
  151. } eonstat;
  152.  
  153. #undef IncStat
  154. #define IncStat(xxx) eonstat.xxx++
  155.  
  156. typedef struct qhdr {
  157.     struct qhdr *link, *rlink;
  158. } *queue_t;
  159.  
  160. struct eon_llinfo {
  161.     struct    qhdr el_qhdr;        /* keep all in a list */
  162.     int    el_flags;        /* cache valid ? */
  163.     int    el_snpaoffset;        /* IP address contained in dst nsap */
  164.     struct    rtentry *el_rt;        /* back pointer to parent route */
  165.     struct    eon_iphdr el_ei;    /* precomputed portion of hdr */
  166.     struct    route el_iproute;    /* if direct route cache IP info */
  167.                     /* if gateway, cache secondary route */
  168. };
  169. #define el_iphdr el_ei.ei_ip
  170. #define el_eonhdr el_ei.ei_eh
  171.